package fr.sportcom.sportcom.model;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class Comment {

	private int id;
	private Date date;
	private String user;
	private String content;
	
	public Comment(int id, String date, String content, String user) {
		setId(id);
		setDate(date);
		setUser(user);
		setContent(content);
	}
	
	/**
	 * @return the id
	 */
	public int getId() {
		return id;
	}
	
	/**
	 * @param id the id to set
	 */
	public void setId(int id) {
		this.id = id;
	}
	
	/**
	 * @return the date
	 */
	public Date getDate() {
		return date;
	}
	
	/**
	 * @param date the date to set
	 */
	public void setDate(Date date) {
		this.date = date;
	}

	/**
	 * @param begin the begin to set
	 */
	public void setDate(String date) {
		final DateFormat dFm = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.FRANCE);
		try {
			this.date = dFm.parse(date);
		} catch (ParseException e) {
			e.printStackTrace();
		}
	}
	
	/**
	 * @return the user
	 */
	public String getUser() {
		return user;
	}
	
	/**
	 * @param user the user to set
	 */
	public void setUser(String user) {
		this.user = user;
	}
	
	/**
	 * @return the content
	 */
	public String getContent() {
		return content;
	}
	
	/**
	 * @param content the content to set
	 */
	public void setContent(String content) {
		this.content = content;
	}
	
	public String getStrDate() {
		final DateFormat dFm = new SimpleDateFormat("dd-MM-yyyy   HH:mm", Locale.FRANCE);
		return dFm.format(date);
	}
}
